<?php 
function geo_ip($ip){
 include_once("geoipcity.inc");
 include_once("geoipregionvars.php");
 $gi = geoip_open("GeoLiteCity.dat",GEOIP_STANDARD);   //调用MaxMind IP数据
 $record = geoip_record_by_addr($gi,$ip);
 $arr = Array(
  "country_code" => $record->country_code, //国家代码
  "country_name" => $record->country_name,		//国家
  "region" => $GEOIP_REGION_NAME[$record->country_code][$record->region], //地区
  "city" => $record->city,		//城市
  "postal_code" => $record->postal_code, //邮政编码
  "latitude" => $record->longitude.", ".$record->latitude, //经纬度
  "continent_code" => $record->continent_code //区域
  );
 // $newarr = array_filter($arr);
 // foreach($newarr as $key => $value){
 //  echo $key." => ".$value.'<br>';
 // }
 var_dump($arr);
  return  $str =  $arr['country_name'] . $arr['region']  . $arr['city'] ;
}
echo geo_ip("119.177.88.114");